package code.easylevel;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream.GetField;
import java.io.Reader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Ashish Sonawane
 * 
 * Your program should accept a file as its first argument. 
 * The file contains multiple separated lines; each line contains 3 numbers that are space delimited. 
 * The first number is the first divider (X), the second number is the second divider (Y), 
 * and the third number is how far you should count (N). 
 * You may assume that the input file is formatted correctly and the numbers are valid positive integers.
 *
 */
public class FizzBuzz {
	protected static int firstDivider;
	protected static int secondDivider;
	protected static int count;
	public static void main(String[] args) throws IOException{
			BufferedReader bufferedReader;
			String line;
			File file = new File(args[0]);
			bufferedReader = new BufferedReader(new FileReader(file));
			while((line=bufferedReader.readLine()) != null){
				String[] inputParams = line.split("\\s");
				firstDivider = Integer.parseInt(inputParams[0]);
				secondDivider = Integer.parseInt(inputParams[1]);
				count = Integer.parseInt(inputParams[2]);
				doFizzBuzz();
			}
			bufferedReader.close();
	}
	
	public static void doFizzBuzz(){
		for(int i=1; i<=count; i++){
			if(i%firstDivider==0 && i%secondDivider==0){
				System.out.print("FB ");
			}else if (i%firstDivider==00){
				System.out.print("F ");
			}else if (i%secondDivider==00){
				System.out.print("B ");
			}else{
				System.out.print(i+" ");
			}
		}
		System.out.println("");
	}

}
